<?php
/* @var $this GiftRemainingNumberController */
/* @var $model GiftRemainingNumber */

$this->breadcrumbs=array(
	Yii::t('base','Gift Remaining Numbers')=>array('index'),
	Yii::t('base','Manage'),
);


Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#gift-remaining-number-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1><?php echo Yii::t('base','Manage');echo Yii::t('base','Gift Remaining Numbers');?></h1>

<?php echo Yii::t('base','<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>');?>

<?php echo CHtml::link(Yii::t('base','Advanced Search'),'#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'gift-remaining-number-grid',
	'dataProvider'=>$model->search(),
	//'filter'=>$model,
	'itemsCssClass'=>'responsive table table-striped table-bordered',
	'pager'=>array('class'=>'CLinkPager','hiddenPageCssClass'=>'','firstPageCssClass'=>'first paginate_button','htmlOptions'=>array('class'=>'dataTables_paginate paging_full_numbers"'),'header'=>""),
	'pagerCssClass'=>'pagination',
	'cssFile'=>false,
	'template'=>'{items}{summary}{pager}',
	'columns'=>array(
		'gift_remaining_id',
		array('name'=>'partners_id','value'=>'User::model()->findByPk($data->partners_id)->user_name'),
		'total',
		'remaining_number',
		array('name'=>'gift_id','value'=>'DistributionGiftNumber::model()->getGiftDescribe($data->gift_id);'),
		/*
		 * 'bak1',
		'bak2',
		'bak3',
		'is_delete',
		'crate_time',
		'crate_user',
		'update_time',
		'update_user',
		*/
	),
)); ?>
